package com.spider;

/**
 * 制定扒取规则类
 * a标签是重要的数据来源，在a标签的最上一级标签（除过 boby）设置它的type 如id 或 class 或者其他类型
 * 且对它的name也要进行确定
 * <p>
 * 或者说a标签所属的总div 例如
 * <div class="cont_right" style="padding-left:5px;">
 * <a><a/>
 * </>
 *
 * @author Conceit
 * @version 1.0, 2017/1/9
 */
public class Rule {
    //请求的链接
    private String url;
    //参数集合
    private String[] params;
    //参数对应的值
    private String[] values;
    //对返回的HTML，第一次过滤所使用的标签，请先设置type
    private String resultTagName;
    //CLASS/ID/SELECTION
    //设置resultTagName的类型，默认为id
    private int type = ID;
    //请求的类型，默认为GET
    private int requestMethod = GET;
    //请求相似的标题
    private String[] keywordTitle;


    public final static int GET = 0;
    public final static int POST = 1;

    public final static int CLASS = 0;
    public final static int ID = 1;
    public final static int SELECTION = 2;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String[] getParams() {
        return params;
    }

    public void setParams(String[] params) {
        this.params = params;
    }

    public String[] getValues() {
        return values;
    }

    public void setValues(String[] values) {
        this.values = values;
    }

    public String getResultTagName() {
        return resultTagName;
    }

    public void setResultTagName(String resultTagName) {
        this.resultTagName = resultTagName;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getRequestMethod() {
        return requestMethod;
    }

    public void setRequestMethod(int requestMethod) {
        this.requestMethod = requestMethod;
    }

    public String[] getKeywordTitle() {
        return keywordTitle;
    }

    public void setKeywordTitle(String[] keywordTitle) {
        this.keywordTitle = keywordTitle;
    }

    public Rule(String url, String[] params, String[] values, String resultTagName, int type, int requestMethod, String[] keywordTitle) {
        this.url = url;
        this.params = params;
        this.values = values;
        this.resultTagName = resultTagName;
        this.type = type;
        this.requestMethod = requestMethod;
        this.keywordTitle = keywordTitle;
    }

    public Rule() {
    }
}
